﻿<mah:MetroWindow
    x:Class="BombaJob.Views.ShellView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
    xmlns:properties="clr-namespace:BombaJob.Properties" 
    xmlns:ctrls="clr-namespace:BombaJob.Utilities.Controls"
    xmlns:cal="http://www.caliburnproject.org"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:tb="http://www.hardcodet.net/taskbar"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    WindowStartupLocation="CenterScreen" 
    Icon="/BombaJob;component/Images/bombajob.ico"
    mc:Ignorable="d" 
    d:DesignHeight="600"
    d:DesignWidth="600">

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <ctrls:TimeTicker x:Key="timeTicker" />
            <ctrls:OfferCountTicker x:Key="ocTicker" />
        </ResourceDictionary>
    </Window.Resources>

    <Window.Background>
        <LinearGradientBrush MappingMode="Absolute" StartPoint="0,0" EndPoint="0,380">
            <GradientStop Color="#EBEBEB"  />
            <GradientStop Color="White" Offset="1" />
        </LinearGradientBrush>
    </Window.Background>

    <mah:MetroWindow.WindowCommands>
        <mah:WindowCommands>
            <Button Content="{x:Static properties:Resources.menu_Sync}"
                    x:Name="Synchronize" cal:Message.Attach="Synchronize"
                    IsEnabled="{Binding TabberEnabled}"/>
            <Button Content="{x:Static properties:Resources.menu_Settings}"
                    x:Name="Settings" cal:Message.Attach="Settings"
                    IsEnabled="{Binding TabberEnabled}"/>
            <Button x:Name="About" cal:Message.Attach="About"
                    IsEnabled="{Binding TabberEnabled}">
                <Image Source="/Images/bmabout.png"
                       ToolTip="{x:Static properties:Resources.menu_About}"
                       Width="24" Height="24"/>
            </Button>
            <StackPanel>
                <TextBox MinWidth="150" Name="txtSearch" Foreground="OrangeRed"
                         mah:TextboxHelper.Watermark="{x:Static properties:Resources.search_For}" mah:TextboxHelper.ClearTextButton="True"
                         cal:Message.Attach="[Event KeyUp] = [Action Search($source, $eventArgs)]"
                         IsEnabled="{Binding TabberEnabled}"/>
            </StackPanel>
        </mah:WindowCommands>
    </mah:MetroWindow.WindowCommands>

    <mah:MetroContentControl>
        <Grid>

            <tb:TaskbarIcon x:Name="BMNotifyIcon" IconSource="/Images/bombajob.ico" ToolTipText="{x:Static properties:Resources.appName}">
                <tb:TaskbarIcon.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="{Binding MaxMinLabel}" cal:Message.Attach="TBOpen" />
                        <MenuItem Header="{x:Static properties:Resources.tb_Settings}" cal:Message.Attach="TBSettings" />
                        <Separator/>
                        <MenuItem Header="{x:Static properties:Resources.menu_Sync}" cal:Message.Attach="TBSync" />
                        <Separator/>
                        <MenuItem Header="{x:Static properties:Resources.tb_Exit}" cal:Message.Attach="TBExit" />
                    </ContextMenu>
                </tb:TaskbarIcon.ContextMenu>

            </tb:TaskbarIcon>

            <Border Background="White" Opacity="0.7"
                Visibility="{Binding IsOverlayVisible, Converter={StaticResource boolToVisibilityConverter}}"
                HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
            
            <ContentControl x:Name="ActiveItem" IsEnabled="{Binding TabberEnabled}" Opacity="{Binding TabberOpacity}" Margin="0,0,0,10" />
            
            <mah:ProgressRing IsActive="True" Foreground="Black" Background="{x:Null}"
                            Visibility="{Binding IsOverlayVisible, Converter={StaticResource boolToVisibilityConverter}}"
                            HorizontalAlignment="Center" VerticalAlignment="Center" />
            
            <StatusBar VerticalAlignment="Bottom">
                <StatusBar.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="4*"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="200"/>
                            </Grid.ColumnDefinitions>
                        </Grid>
                    </ItemsPanelTemplate>
                </StatusBar.ItemsPanel>
                <StatusBarItem Content="{Binding Source={StaticResource ocTicker}, Path=OffersCount, Mode=OneWay}" FontWeight="Bold" />
                <StatusBarItem Grid.Column="1">
                    <StackPanel Visibility="{Binding IsOverlayVisible, Converter={StaticResource boolToVisibilityConverter}}">
                        <mah:ProgressIndicator Width="100" Height="18" ProgressColour="{StaticResource AccentColorBrush}" />
                    </StackPanel>
                </StatusBarItem>
                <StatusBarItem Grid.Column="2" Content="{Binding SBStatus}" />
                <StatusBarItem Grid.Column="3" Content="{Binding Source={StaticResource timeTicker}, Path=Now, Mode=OneWay}"/>
            </StatusBar>
            
        </Grid>
    </mah:MetroContentControl>

</mah:MetroWindow>
